package com.ruoyi.project.tool.swagger;

import java.io.IOException;

import org.apache.commons.httpclient.HttpClient;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;



public class sendvoice {

    private static String Url = "http://api.vm.ihuyi.com/webservice/voice.php?method=Submit";

    public static void main(String [] args) {

        HttpClient client = new HttpClient();
        PostMethod method = new PostMethod(Url);

        //client.getParams().setContentCharset("GBK");
        client.getParams().setContentCharset("UTF-8");
        method.setRequestHeader("ContentType","application/x-www-form-urlencoded;charset=UTF-8");
        NameValuePair[] data = {//提交短信
                new NameValuePair("account", "VM95014607"),//用户名是登录用户中心->语音通知->帐户参数设置->APIID
                new NameValuePair("password", "e6dc27aaa3b020ae10be0909c85fb1ac"),//查看密码请登录用户中心->语音通知->帐户参数设置->APIKEY
                new NameValuePair("mobile", "18252578446"),//手机号码
                new NameValuePair("content", "尊敬的管理员, 2222的2222在2222发生2222，请尽快处理！"),
        };
        method.setRequestBody(data);
        try {
            client.executeMethod(method);
            String SubmitResult = method.getResponseBodyAsString();
            System.out.println(SubmitResult);
        } catch (HttpException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}
